import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';

@Injectable()
export class ShopSettingService {
    constructor(@InjectModel('ShopSetting') private readonly shopSettingModel) {}
    async find(where = {}, fields = null) {
        return await this.shopSettingModel.find(where, fields).sort({ sort: 1 });
    }
    async create(shopSettingInfo) {
        return await this.shopSettingModel.create(shopSettingInfo);
    }
    async update(shopSettingInfo) {
        return await this.shopSettingModel.updateOne({ _id: shopSettingInfo._id }, shopSettingInfo);
    }
    async delete(shopSettingInfo) {
        return await this.shopSettingModel.deleteOne(shopSettingInfo);
    }
    getModel() {
        return this.shopSettingModel;
    }
}
